package view;

import javax.swing.*;
import java.awt.*;

public class MainView {

    public void showLoginUi() {
        JFrame jf = new JFrame("登录");
        jf.setIconImage(Toolkit.getDefaultToolkit().createImage(MainView.class.getResource("qq.jpg")));
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel jp = new JPanel();
        JLabel jl1 = new JLabel("登录        ");
        jl1.setFont(new Font("黑体", Font.BOLD, 24));
        JButton bu1 = new JButton("管理员登录");
        JButton bu2 = new JButton("用户 登录");
        JButton bu3 = new JButton("退    出");
        jp.setLayout(null);
        jl1.setBounds(200, 1, 200, 50);
        bu1.setBounds(175, 100, 100, 50);
        bu2.setBounds(175, 200, 100, 50);
        bu3.setBounds(175, 300, 100, 50);
        jp.add(jl1);
        jp.add(bu1);
        jp.add(bu2);
        jp.add(bu3);
        jf.add(jp);
        jf.setVisible(true);
        jf.setBounds(600, 200, 500, 500);

        bu1.addActionListener(e -> {
            AdministratorView administratorView = new AdministratorView();
            administratorView.loginUi();
        });
        bu2.addActionListener(e -> {
            UserView userView = new UserView();
            userView.loginUi();
        });
        bu3.addActionListener(e -> System.exit(0));
    }

    public static void main(String[] args) {
        MainView mainView = new MainView();
        mainView.showLoginUi();
    }
}